package cn.cool.task;

import cn.cool.service.UserLikeArticleService;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;

/**
 * 点赞的定时任务
 * @author LiuH
 * @create 2021-02-08 下午 3:24
 */
public class LikeTask extends QuartzJobBean {

    @Autowired
    private UserLikeArticleService userLikeArticleService;

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        System.out.println("启动定时任务....");
//        //持久化到数据库
//        int i = userLikeArticleService.saveArtLikeRedisToDB();

//        if (i > 0){//插入失败不清除缓存
//            userLikeArticleService.clearCache();
//        }

        System.out.println("启动定时任务执行完毕....");
    }
}
